<template>
  <div class="header">
    <div class="l-content">
      <el-button size="small" @click="handleCollapse"
        ><el-icon><Menu /></el-icon
      ></el-button>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown size="small" trigger="click">
        <span class="el-dropdown-link">
          <img :src="getImgSrc('vite')" />
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>个人中心</el-dropdown-item>
            <el-dropdown-item>退出</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import {useStore} from 'vuex'
export default {
  setup() {
    let store = useStore()
    const getImgSrc = (vite) => {
      return new URL(`../../public/${vite}.svg`, import.meta.url).href;
    };
    let handleCollapse = () => {
      store.commit('updateIsCollapse')
    }

    return {
      getImgSrc,
      handleCollapse
    };
  },
};
</script>

<style scoped>
.header {
  height: 100%;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #000;
}
.l-content {
  display: flex;
  align-items: center;
}
.r-content {
  padding: 3px;
  background-color: blue;
  border-radius: 50%;
}
.r-content img {
  width: 30px;
  height: 30px;
}
.el-breadcrumb {
  margin-left: 25px;
}
</style>